export default {
  namespace: 'gData',
  state: {
    conut: 1,
    thisRoute: [], //当前页面的路由定位
  },
  reducers: {
    add (state, action) {
      return {
        conut: state.conut + 2,
      };
    },
    asyncFun (state, action) {
      return {
        conut: state.conut + 4,
      };
    },
    // ==========
    // 确定当前页面的路由定位
    getThisRoute (state, action) {
      return {
        thisRoute: action.param,
      };
    },
  },
  effects: {
    //这里是做异步处理的
    *addByONe ({param}, {call, put, select}) {
      //这里使用select
      const num = yield select (state => state.num); //这里就获取到了当前state中的数据num
      let param1;
      param1 = num + param;
      yield put ({
        type: 'save',
        num: param1,
      });
    },
  },
};
